#include "Comm.hpp"

int main()
{
    key_t key = GetShmkeyOrDie();
    cout << "key: " << ToHex(key) << endl;

    int shmid = CreateShm(key,SIZE);
    cout << "shmid: " << shmid << endl;

    char* addr = (char*)ShmAttach(shmid);
    cout << "addr: sucess" << endl;
    //DebugShm(shmid);

    memset(addr,0,SIZE);
    for(char c = 'A'; c <= 'Z'; c++)
    {
        addr[c-'A'] = c;
        sleep(1);
    }

    ShDetach((void*)addr);
    cout << "ShDetach: sucess" << endl;
    sleep(2);
    DeleteShm(shmid);
    return 0;
}

